﻿/***************************************
 * 시스템 변수
 ***************************************/

var MEMORY = new Array();

var curkey = "root";
var mspr = "0";
var menuId = "";

/***************************************
 * 함수
 ***************************************/
 function initTree()
 {

		var menuForm = document.leftForm;
		if (menuForm.BIG_ORD == null) {
			return;
		}

		if(menuForm.BIG_ORD.length >= 2) {
			for(i=0; i<menuForm.BIG_ORD.length ;i++) {
				lvl		 =  menuForm.LVL[i].value;
				big_ord	 =  menuForm.BIG_ORD[i].value;
				mid_ord	 =  menuForm.MID_ORD[i].value;
				sml_ord	 =  menuForm.SML_ORD[i].value;
				big_cd	 =  menuForm.BIG_CD[i].value;
				mid_cd	 =  menuForm.MID_CD[i].value;
				sml_cd   =  menuForm.SML_CD[i].value;
				menu_id  =  menuForm.MENU_ID[i].value;
				menu_nm  =  menuForm.MENU_NM[i].value;
				link_yn  =  menuForm.LINK_YN[i].value;
				page_url =  menuForm.PAGE_URL[i].value;

				addMemory( lvl, big_ord, mid_ord, sml_ord, big_cd, mid_cd, sml_cd, menu_id, menu_nm, link_yn, page_url);
			}
		}else if(menuForm.BIG_ORD.length == 1) {
			lvl	 	=  menuForm.LVL.value;
			big_ord	 =  menuForm.BIG_ORD.value;
			mid_ord	 =  menuForm.MID_ORD.value;
			sml_ord	 =  menuForm.SML_ORD.value;
			big_cd	 =  menuForm.BIG_CD.value;
			mid_cd	 =  menuForm.MID_CD.value;
			sml_cd   =  menuForm.SML_CD.value;
			menu_id  =  menuForm.MENU_ID.value;
			menu_nm  =  menuForm.MENU_NM.value;
			link_yn  =  menuForm.LINK_YN.value;
			page_url =  menuForm.PAGE_URL.value;

			addMemory( lvl, big_ord, mid_ord, sml_ord, big_cd, mid_cd, sml_cd, menu_id, menu_nm, link_yn, page_url);
		}

 }

function addMemory( lvl, big_ord, mid_ord, sml_ord, big_cd, mid_cd, sml_cd, menu_id, menu_nm, link_yn , page_url)
{
     var index = MEMORY.length;
     MEMORY[index] = new Object;
	 MEMORY[index].lvl  	= lvl;
     MEMORY[index].big_ord  = big_ord;
     MEMORY[index].mid_ord  = mid_ord;
	 MEMORY[index].sml_ord  = sml_ord;
     MEMORY[index].big_cd   = big_cd;
     MEMORY[index].mid_cd   = mid_cd;
     MEMORY[index].sml_cd   = sml_cd;
     MEMORY[index].menu_id  = menu_id;
     MEMORY[index].menu_nm  = menu_nm;
     MEMORY[index].link_yn  = link_yn;
     MEMORY[index].page_url = page_url;

}

// 메뉴 아이템 클릭시 메뉴 아이디 저장 //
function clickOnMenuID(menuId)
{
	this.menuId = menuId;
}